#!/usr/bin/env python
import os
import json
import logging
import zipfile
import requests
from tqdm import tqdm
from vocab import Vocab
from embeddings import GloveEmbedding, KazumaCharEmbedding
from dataset import Dataset, Ontology


root_dir = os.path.dirname(__file__)
data_dir = os.path.join(root_dir, 'data', 'woz')


furl = 'https://mi.eng.cam.ac.uk/~nm480/woz_2.0.zip'
fzip = os.path.join(data_dir, 'woz.zip')

draw = os.path.join(data_dir, 'raw')
dann = os.path.join(data_dir, 'ann')

splits = ['dev', 'train', 'test']


def download(url, to_file):
    r = requests.get(url, stream=True)
    with open(to_file, 'wb') as f:
        for chunk in r.iter_content(chunk_size=1024):
            if chunk:
                f.write(chunk)


def missing_files(d, files):
    return not all([os.path.isfile(os.path.join(d, '{}.json'.format(s))) for s in files])


if __name__ == '__main__':

    embeddings = [GloveEmbedding(), KazumaCharEmbedding()]
    print(embeddings)
